package com.xiaomili.halfsugar.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.xiaomili.halfsugar.constant.UrlString;
import com.xiaomili.halfsugar.fragment.ViewPagerFragment;

import java.util.List;

/**
 * Created by WangQi on 2016/7/15.
 */
public class ViewPagerAdapter extends FragmentPagerAdapter {
    private List<String> mList;
    private static final String TAG = "ViewPagerAdapter";

    public ViewPagerAdapter(FragmentManager fm, List<String> list) {
        super(fm);
        this.mList = list;
    }

    @Override
    public Fragment getItem(int position) {
        return ViewPagerFragment.newInstance(UrlString.INDEX_URL[position],position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mList.get(position).toString();
    }

    @Override
    public int getCount() {
        return mList.size();
    }
}
